[TAGLIBS] anidar tag en atributo
Hola,
tenemos definidos dos taglibs uno para la obtenci贸n de datos (data) y otro relacionado con la presentaci贸n de los contenidos (pres). Nos encontramos que en algunas p谩ginas JSP tenemos que pintar (usando un tag de pres) datos directamente obtenidos de un tag data. Un ejemplo:
<pres:pintaCaja titulo="<data:getTitle (Filter)/>">
<data:getText (Filter)/>
</pre:pintaCaja>
el tag pintaCaja lo tenemos definido de la siguiente manera:
<tag>
<name>pintaCaja</name>
<tag-class>com.xxxxxx.presentation.jsp.pintaCajaTag</tag-class>
<body-content>JSP</body-content>
<description>
This tag creates a box for html content
</description>
<attribute>
<name>titulo</name>
</attribute>
</tag>
y la implementaci贸n del tag:
public class pintaCajaTag extends BodyTagSupport{
....
public String getTitulo() { return Titol; }
public void setTitulo(String Titol) { this.Titol = Titol; }
....
public int doStartTag() throws JspException {
try{
pageContext.getOut().print(Titol);
}
catch (IOException e) {
throw new JspException ("Error: IOException" + e.getMessage());
}
return EVAL_PAGE;
}
public int doEndTag() throws JspException {
return EVAL_PAGE;
}
public int doAfterBody() throws JspException {
try {
BodyContent bc = getBodyContent();
String cuerpo = bc.getString();
JspWriter out = bc.getEnclosingWriter();
out.print(cuerpo);
}
catch (IOException e){
throw new JspException("Error: IOEXception" + e.getMessage());
}
return SKIP_BODY;
}
}
Actualmente cuando anidamos el tag dentro del atributo titulo simplemente no lo interpreta (y devuelve <data:getTitle (Filter)/>).
Alguien puede echarnos una mano?
Saludos,
tenemos definidos dos taglibs uno para la obtenci贸n de datos (data) y otro relacionado con la presentaci贸n de los contenidos (pres). Nos encontramos que en algunas p谩ginas JSP tenemos que pintar (usando un tag de pres) datos directamente obtenidos de un tag data. Un ejemplo:
<pres:pintaCaja titulo="<data:getTitle (Filter)/>">
<data:getText (Filter)/>
</pre:pintaCaja>
el tag pintaCaja lo tenemos definido de la siguiente manera:
<tag>
<name>pintaCaja</name>
<tag-class>com.xxxxxx.presentation.jsp.pintaCajaTag</tag-class>
<body-content>JSP</body-content>
<description>
This tag creates a box for html content
</description>
<attribute>
<name>titulo</name>
</attribute>
</tag>
y la implementaci贸n del tag:
public class pintaCajaTag extends BodyTagSupport{
....
public String getTitulo() { return Titol; }
public void setTitulo(String Titol) { this.Titol = Titol; }
....
public int doStartTag() throws JspException {
try{
pageContext.getOut().print(Titol);
}
catch (IOException e) {
throw new JspException ("Error: IOException" + e.getMessage());
}
return EVAL_PAGE;
}
public int doEndTag() throws JspException {
return EVAL_PAGE;
}
public int doAfterBody() throws JspException {
try {
BodyContent bc = getBodyContent();
String cuerpo = bc.getString();
JspWriter out = bc.getEnclosingWriter();
out.print(cuerpo);
}
catch (IOException e){
throw new JspException("Error: IOEXception" + e.getMessage());
}
return SKIP_BODY;
}
}
Actualmente cuando anidamos el tag dentro del atributo titulo simplemente no lo interpreta (y devuelve <data:getTitle (Filter)/>).
Alguien puede echarnos una mano?
Saludos,
